<template>
  <div class="school">
      <h2>这是school组件</h2>
      <p>学校名称:{{name}}</p>
      <p>学校地址:{{address}}</p>
      <button @click="sendName(name)">把School组件的学校名称交给News</button>
  </div>
</template>

<script>
  export default {
    name:'School',
    data(){
        return {
            name: '衡水一中',
            address:'衡水'
        }
    },
    methods: {
        sendName(name){
            this.$bus.$emit('haha',name);
        }
    },
  }
</script>

<style scoped>
    .school{
        background-color: #83c5be;
        padding: 20px;
    }
    
</style>